<!DOCTYPE html>
<html lang="zh" xmlns:th="http://www.thymeleaf.org" xmlns:shiro="http://www.pollix.at/thymeleaf/shiro">
<head>
    <th:block th:include="include :: header('漫画爬虫错误列表')" />
    <!--select 下拉框-->
    <th:block th:include="include :: select2-css"/>
</head>
<body class="gray-bg">
<div class="container-div">
    <div class="row">
        <div class="col-sm-12 search-collapse">
            <form id="formId">
                <div class="select-list">
                    <ul>
                        <li>
                            <label>爬取ID：</label>
                            <input type="text" name="climbId"/>
                        </li>
                        <li>
                            <label>漫画id：</label>
                            <!--<input type="text" name="nameId"/>-->
                            <select name="nameId" class="form-control m-b" th:with="type=${MhNameDataAll}">
                                <option value=""></option>
                                <option th:each="map : ${type}" th:text="${map.value}" th:value="${map.key}"></option>
                            </select>
                        </li>

                        <li>
                            <label>那个网站：</label>
                            <select name="webType" class="form-control m-b" th:with="type=${@all.toAll()}">
                                <option value="">所有</option>
                                <option th:each="map : ${type}" th:text="${map.key}" th:value="${map.value}"></option>
                            </select>
                        </li>
                        <li>
                            <label>错误状态：</label>
                            <select name="status" class="form-control m-b" th:with="type=${@all.mistakeEnumAll()}">
                                <option value="">所有</option>
                                <option th:each="map : ${type}" th:text="${map.key + map.value}" th:value="${map.key}"></option>
                            </select>
                        </li>
                        <li>
                            <a class="btn btn-primary btn-rounded btn-sm" onclick="$.table.search()"><i class="fa fa-search"></i>&nbsp;搜索</a>
                            <a class="btn btn-warning btn-rounded btn-sm" onclick="$.form.reset()"><i class="fa fa-refresh"></i>&nbsp;重置</a>
                        </li>
                    </ul>
                </div>
            </form>
        </div>

        <div class="btn-group-sm" id="toolbar" role="group">
            <a class="btn btn-success" onclick="$.operate.add()" shiro:hasPermission="manhua:mistake:add">
                <i class="fa fa-plus"></i> 添加
            </a>
            <a class="btn btn-primary single disabled" onclick="$.operate.edit()" shiro:hasPermission="manhua:mistake:edit">
                <i class="fa fa-edit"></i> 修改
            </a>
            <a class="btn btn-danger multiple disabled" onclick="$.operate.removeAll()" shiro:hasPermission="manhua:mistake:remove">
                <i class="fa fa-remove"></i> 删除
            </a>
            <a class="btn btn-warning" onclick="$.table.exportExcel()" shiro:hasPermission="manhua:mistake:export">
                <i class="fa fa-download"></i> 导出
            </a>
        </div>
        <div class="col-sm-12 select-table table-striped">
            <table id="bootstrap-table"></table>
        </div>
    </div>
</div>
<th:block th:include="include :: footer" />
<!--select 下拉框-->
<th:block th:include="include :: select2-js"/>
<script th:inline="javascript">

    var editFlag = [[${@permission.hasPermi('manhua:mistake:edit')}]];

    var removeFlag = [[${@permission.hasPermi('manhua:mistake:remove')}]];

    var prefix = ctx + "manhua/mistake";

    let MhNameDataAll = [[${MhNameDataAll}]];

    $(function() {
        var options = {
            url: prefix + "/list",
            createUrl: prefix + "/add",
            updateUrl: prefix + "/edit/{id}",
            removeUrl: prefix + "/remove",
            exportUrl: prefix + "/export",
            modalName: "漫画爬虫错误",
            columns: [{
                checkbox: true
            },
                {
                    field: 'id',
                    title: '错误状态',
                    visible: false
                },
                {
                    field: 'climbId',
                    title: '爬虫ID'
                },
                {
                    field: 'nameId',
                    title: '漫画ID',
                    formatter: function (value, row, index) {
                        return $.common.reale({value: MhNameDataAll[value], numder: 2});
                    }
                },
                {
                    field: 'mistake',
                    title: '错误地址',
                    formatter: function (value, row, index) {
                        return $.table.tooltip(value,null,"open");
                    }
                },
                {
                    field: 'chapterName',
                    title: '篇章名称',
                    formatter: function (value, row, index) {
                        return $.common.reale({value: value, numder: 2});
                    }
                },
                {
                    field: 'chapterId',
                    title: '篇章ID',
                    formatter: function (value, row, index) {
                        return $.common.reale({value: value, numder: 3});
                    }
                },
                {
                    field: 'pageOrder',
                    title: '页数顺序',
                    formatter: function (value, row, index) {
                        return $.common.reale({value: value, numder: 2});
                    }
                },
                {
                    field: 'pageId',
                    title: '页数ID',
                    formatter: function (value, row, index) {
                        return $.common.reale({value: value, numder: 3});
                    }
                },
                {
                    field: 'webType',
                    title: '网站',
                    formatter: function (value, row, index) {
                        return $.common.reale({value: value, numder: 2});
                    }
                },
                {
                    field: 'status',
                    title: '错误状态',
                    formatter: function (value, row, index) {
                        return $.common.reale({value: value, numder: 1});
                    }
                },
                {
                    field: 'numberCi',
                    title: '爬取次数',
                    formatter: function (value, row, index) {
                        if(value != 3){
                            return $.common.reale({value: value, numder: 1});
                        }else{
                            return $.common.reale({value: value, numder: 4});
                        }
                    }
                },
                {
                    field: 'remark',
                    title: '备注',
                    formatter: function (value, row, index) {
                        return $.table.tooltip(value,null,"open");//传值 长度不传添加所有字节
                    }
                },
                {
                    title: '操作',
                    align: 'center',
                    formatter: function(value, row, index) {
                        var actions = [];
                        actions.push('<a class="btn btn-success btn-xs ' + editFlag + '" href="javascript:void(0)" onclick="$.operate.edit(\'' + row.id + '\')"><i class="fa fa-edit"></i>编辑</a> ');
                        actions.push('<a class="btn btn-danger btn-xs ' + removeFlag + '" href="javascript:void(0)" onclick="$.operate.remove(\'' + row.id + '\')"><i class="fa fa-remove"></i>删除</a>');
                        return actions.join('');
                    }
                }]
        };
        $.table.init(options);
    });

</script>
</body>
</html>